#ifndef RENDER_PIPELINE_H
#define RENDER_PIPELINE_H

#define draw_obj(a) render_pipeline::self()->_draw(a)
#define draw_scene() render_pipeline::self()->_draw_scene()

#define time_elapsed() render_pipeline::self()->_time_elapsed()

#define reset_cam() render_pipeline::self()->_reset_cam()
#define update_cam(a,b,c) render_pipeline::self()->_update_cam(a,b,c)

#define camera_x render_pipeline::self()->cam_x
#define camera_y render_pipeline::self()->cam_y
#define camera_rot render_pipeline::self()->cam_rot
#define camera_obzor render_pipeline::self()->obzor


#include "SDL/SDL.h"
#include "SDL/SDL_opengl.h"
#include "GL/gl.h"
#include "GL/glu.h"
#include "GL/glx.h"
#include "GL/glext.h"
#include <stdio.h>

class render_pipeline;

#include "common.h"
#include "obj.h"
#include "timer.h"

void something();

class render_pipeline {
	private:
		render_pipeline();
		int occlusion_test();
		
		int load_settings();
		int save_settings();

		int SCREEN_WIDTH;
		int SCREEN_HEIGHT;
		int SCREEN_BPP;
		int FRAMES_PER_SECOND;
		int FULLSCREEN;
		int C_FPS;	//ci ma limitovat fps pri vykreslovani

		Timer fps_reg;
		int last_frame_lenght;
	public:
		static render_pipeline * self();
		
		float cam_x,cam_y,cam_rot,cam_spd;
		float obzor;
		void _reset_cam(){cam_x=cam_y=cam_rot=0;}
		void _update_cam(float,float,float);
		
		bool init_GL();
		bool init();
		bool createWindow();
		
		double _time_elapsed(){return last_frame_lenght/1000.;}
		
		int get_screen_width(){return SCREEN_WIDTH;}
		int get_screen_height(){return SCREEN_HEIGHT;}
		
		void _draw(obj * object);
		void _draw_scene();
		
};

#endif
